package dtn.models;

import dtn.supports.Tools;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;

public class News {

	private String iconUrl = null;
	private String title = null;
	private String content_hot = null;
	private String viewUrl = null;
	private String content_detail = "";
	private String id = null;
	private Drawable image = null;
	private boolean isLoaded = false;

	public News() {
	}

	public News(String title, String content, String url, String vurl) {
		initialize("", title, content, url, vurl, "");
	}

	public News(String id, String title, String content_hot, String url,
			String vurl, String content_detail) {
		initialize(id, title, content_hot, url, vurl, content_detail);
	}

	public void initialize(String id, String title, String content_hot,
			String url, String vurl, String content_detail) {
		iconUrl = url;
		viewUrl = vurl;
		this.title = title;
		this.content_hot = content_hot;
		this.id = id;
		this.content_detail = content_detail;
	}

	public String getIconUrl() {
		return (iconUrl);
	}

	public String getTitle() {
		return (title);
	}

	public String getContent() {
		return (content_hot);
	}

	public String getViewUrl() {
		return (viewUrl);
	}

	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getContentDetail() {
		return this.content_detail;
	}

	public void setContentDetail(String content_detail) {
		this.content_detail = content_detail;
	}

	public Drawable getImage() {
		if (image != null)
			return image;
		if (!isLoaded) {
			isLoaded = true;
			image = Tools.loadImageFromWeb(iconUrl);

		}

		return image;
	}
	
	public boolean getIsLoaded() {
		return isLoaded;
	}
}
